package springfixture.results;

import fit.Parse;
import fitnesse.fixtures.TableFixture;

public class TextResult extends Result {
    private String text;

    public TextResult(TableFixture tableFixture, String text) {
        super(tableFixture);
        this.text = text;
    }

    public void render(Parse cell) {
        if (text == null) {
            if (cell.text().equals("")) {
                tableFixture.right(cell);
            } else {
                tableFixture.wrong(cell, "was null");
            }
        } else {
            String exspected = cell.text();
            if (exspected.equals(text)) {
                tableFixture.right(cell);
            } else {
                tableFixture.wrong(cell,text);
            }
        }
    }

}